﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Decorate
{
    public class Mocha : CondimentDecorator
    {
        Beverage beverage;

        public Mocha(Beverage beverage)
        {
            // 在这个对象里，把beverage指向直接包装
            // 的beverage对象
            this.beverage = beverage;

            // 统一记住一个size大小.
            // this.size是调味料作为Beverage的size
            // 还可以为增加多少调味料而单独设置
            // this.size = beverage.getSize();
        }

        public override Beverage.Size getSize()
        {
            return beverage.getSize();
        } 

        public override String getDescription()
        {
            // 返回指向对象的描述 + Mocha
            return beverage.getDescription() + ", Mocha";
        }

        public override double cost()
        {
            // 按照杯子大小做特殊处理
            double dRtn = 0.0;

            switch (getSize())
            {
                case Size.tall: dRtn = beverage.cost() + 0.1; break;
                case Size.grande: dRtn = beverage.cost() + 0.15; break;
                case Size.venti: dRtn = beverage.cost() + 0.2; break;
            }

            return dRtn;


            // 返回指向对象的花费 + Mocha的花费

        }
    }
}
